from django.shortcuts import render
from django.template.loader import get_template
from django.template import Context
from django.http import HttpResponse
import csv
# Create your views here.

def report_output(request):
    report_name = request.GET['REPORT_NAME']
    try:
        report_reader = open('D:/Temp/'+report_name, 'rb')
        all_text = report_reader.read()
        response = HttpResponse(all_text, mimetype="application/octet-stream")
        response['Content-Disposition'] = 'attachment; filename='+report_name
        #response['ContentType'] = "application/octet-stream"
    except Exception as e:
        print e
    finally:
        report_reader.close()
    return response